<%@page import="java.util.Date"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/common/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>
<link href="${ctx}resources/css/select/bootstrap-select.css" rel="stylesheet" type="text/css">
<%@ include file="/WEB-INF/common/head.jsp"%>
</head>
<body class="${cookie.bodyClass.value}">
	<div class="container body">
		<div class="main_container">
			<%@ include file="/WEB-INF/common/left.jsp"%>
			<%@ include file="/WEB-INF/common/top.jsp"%>
			<!-- page content -->
			<div class="right_col" role="main" id="main">
				<div class="x_panel">
					<div class="x_title">
						<h2>控制APP审核详情</h2>
						<div class="clearfix"></div>
					</div>
					<div class="x_content">
						<div class="modal-body">
							<form role="form" data-parsley-validate id="controlAuditForm" class="form-horizontal">
								<input id="controlAuditId" name="controlAuditId" type="hidden" value="${controlAudit.controlAuditId}" />
								<div class="form-group item">
									<label for="name" class="col-sm-3 control-label">版本:<font color="red">*</font>
									</label>
									<div class="col-sm-6">
										<input type="text" class="form-control" id="version" name="version" value="${controlAudit.version}" placeholder="版本"
											required='required' data-parsley-length="[0,40]">
									</div>
								</div>
								<div class="form-group item">
								<label for="address" class="col-sm-3 control-label">类型:<font color="red">*</font>
								</label>
								<div class="col-sm-6">
										<span>
											<input type="radio" class="input-xsmall" id="type" name="type" value="0" checked>IOS
											<input type="radio" class="input-xsmall" id="type" name="type" value="1" >安卓
										</span>
								</div>
							</div>
							<div class="form-group item">
								<label for="address" class="col-sm-3 control-label">是否审核:<font color="red">*</font>
								</label>
								<div class="col-sm-6">
										<span>
											<input type="radio" class="input-xsmall" id="isAudit" name="isAudit" value="0"  checked>未审核
											<input type="radio" class="input-xsmall" id="isAudit" name="isAudit" value="1" >审核通过
										</span>
								</div>
							</div>
							</form>
						</div>
						<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12" style="text-align:center">
							<button type="button" class="btn btn-dark btn-sm" onclick="back();">返回</button>
							<button type="button" class="btn btn-primary btn-sm" onclick="save();">保存</button>
						</div>
					</div>
				</div>
			</div>
			<!-- /page content -->
			<%@ include file="/WEB-INF/common/foot.jsp"%>
		</div>
	</div>
	<%@ include file="/WEB-INF/common/script.jsp"%>
	<script src="${ctx}resources/js/select/bootstrap-select.js"></script>
	<script type="text/javascript">
	 
		$(function() {
			var controlAuditId = $("#controlAuditId").val();
			if (controlAuditId != "") {
				 $("input[name='type'][value=${controlAudit.type}]").attr("checked",true); 
				 $("input[name='isAudit'][value=${controlAudit.isAudit}]").attr("checked",true); 
			}
		});
		function back() {
			window.location = ctx + "admin/controlAudit/toControlAuditPage";
		}

		function save() {
			if (!$('#controlAuditForm').parsley().validate()) {
				return;
			}
			swal({
				"title" : "",
				"text" : "正在处理……请稍后",
				"showConfirmButton" : false
			});
			$.ajax({
				url : ctx + "admin/controlAudit/saveOrUpdate?time="
						+ (new Date()).getTime(),
				dataType : "json",
				data : $("#controlAuditForm").serialize(),
				success : function(result) {
					if (result.status == "0") {
						swal({
							title : '',
							text : "保存成功"
						}, function() {
							back();
						});
					} else {
						swal({
							title : '',
							text : result.msg,
							type : "error"
						});
					}
				}
			});
		}
	</script>
</body>
</html>